Skip to content

Refactor zend_object_handlers API to pass zend_object* and zend_string* insted of zval(s).#3780

Closed
dstogov wants to merge 4 commits into
php:masterfrom
dstogov:obj_handlers
Closed

Refactor zend_object_handlers API to pass zend_object* and zend_string* insted of zval(s).#3780
dstogov wants to merge 4 commits into
php:masterfrom
dstogov:obj_handlers

Conversation

@dstogov

@dstogov dstogov commented Jan 31, 2019

Copy link
Copy Markdown
Member

No description provided.

@nikic

nikic commented Jan 31, 2019

Copy link
Copy Markdown
Member

Looks like Windows build is broken:

ext\com_dotnet\com_handlers.c(471): error C2039: 'value': is not a member of '_zend_object'
c:\projects\php-src\zend\zend_types.h(370): note: see declaration of '_zend_object'

@dstogov

dstogov commented Jan 31, 2019 via email

Copy link
Copy Markdown
Member Author

@krakjoe krakjoe added the Feature label Feb 1, 2019
@krakjoe

krakjoe commented Feb 1, 2019

Copy link
Copy Markdown
Member

This is nice for extension authors too, I like ...

@weltling @KalleZ can we get some windows input please ?

@dstogov

dstogov commented Feb 1, 2019 via email

Copy link
Copy Markdown
Member Author

@krakjoe krakjoe added this to the PHP 8.0 milestone Feb 1, 2019
@krakjoe

krakjoe commented Feb 1, 2019

Copy link
Copy Markdown
Member

@dstogov ack, added 8 milestone to make that explicit ... although seems obvious :)

@nikic nikic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, apart from one get_properties usage.

Comment thread Zend/zend_vm_def.h Outdated
Comment thread Zend/zend_vm_def.h Outdated
Comment thread Zend/zend_vm_def.h Outdated
Comment thread ext/dom/php_dom.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, but we might want to change zend_read_property to accept a zobj too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be make sense, but together with zend_update_property...(), zend_unset_property...(), some exception functions and may be others. Let do it separately.

@dstogov

dstogov commented Feb 1, 2019

Copy link
Copy Markdown
Member Author

@nikic thanks for review. I've fixed the get_properties() issue.

@cmb69

cmb69 commented Feb 1, 2019

Copy link
Copy Markdown
Member

I've made a patch for ext/com_dotnet. It compiles, and the test suite shows no regression. Obviously, this part can't work, though.

@weltling

weltling commented Feb 1, 2019

Copy link
Copy Markdown
Contributor

@cmb69 ah, you beat me to it, thanks :)

With the non working part - you can check whether you allocate/free that zval. Or, change the php_com_saproxy->obj so it takes zend_object *. The second option were probably better.

Thanks.

@weltling

weltling commented Feb 1, 2019

Copy link
Copy Markdown
Contributor

@cmb69 also it were better to just adjust the CDNO_FETCH* macros, not putting the exact code everywhere, to make the diff smaller and keep the API.

Thanks.

@cmb69

cmb69 commented Feb 1, 2019

Copy link
Copy Markdown
Member

Thanks, @weltling!

Or, change the php_com_saproxy->obj so it takes zend_object *.

That's intriguing! php_com_saproxy->zobj is a zval *, and php_com_saproxy->obj is a php_com_dotnet_object *. Since the first member of php_com_dotnet_object is the very same zend_object that php_com_saproxy->zobj refers to, it seems we could drop php_com_saproxy->zobj altogether, since PHP 7 moved the refcounting to the zend_object (which is apparently the only reason why a zval * is stored).

also it were better to just adjust the CDNO_FETCH* macros,

The original CDNO_FETCH() macro is still needed elsewhere, so we'd have to introduce another macro.

Anyhow, I'll have a closer look tomorrow.

@cmb69

cmb69 commented Feb 1, 2019

Copy link
Copy Markdown
Member

Since the first member of php_com_dotnet_object is the very same zend_object […]

Which looks not right for PHP 7, though.

PS: Seems to be okay in this case, since there are no default properties.

@dstogov

dstogov commented Feb 4, 2019 via email

Copy link
Copy Markdown
Member Author

@krakjoe

krakjoe commented Feb 4, 2019

Copy link
Copy Markdown
Member

@dstogov are @cmb69 and @weltling finished ? it sounds like they're not ...

@dstogov

dstogov commented Feb 4, 2019

Copy link
Copy Markdown
Member Author

@cmb69 @weltling @krakjoe I hope, I fixed the php_com_saproxy->zobj issue and going to merge after testing.

@nikic

nikic commented Feb 4, 2019

Copy link
Copy Markdown
Member

Can you please also add some notes about this to UPGRADING.INTERNALS?

@dstogov

dstogov commented Feb 4, 2019

Copy link
Copy Markdown
Member Author

@nikic OK I'll do. The PR is merged.

@dstogov dstogov closed this Feb 4, 2019
@cmb69

cmb69 commented Feb 4, 2019

Copy link
Copy Markdown
Member

Thanks, @dstogov! I've pushed a minor fix (a1608b4); looks good to me now. (Besides the aborting bug39606.phpt, but that is unrelated to this PR; will try to have a look.)

@dstogov

dstogov commented Feb 4, 2019

Copy link
Copy Markdown
Member Author

@cmb69 Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants